local skynet = require "skynet"
local filelog = require "filelog"
local msghelper = require "ranklistsvrhelper"
local ranklistredismng = require"ranklistredismng"
local base = require "base"
local msgproxy = require "msgproxy"
local configdao = require "configdao"
local filename = "ranklistsvrcmd.lua"
local RankListsvrCMD = {}

function RankListsvrCMD.process(session, source, event, ...)
	local f = RankListsvrCMD[event] 
	if f == nil then
		filelog.sys_error(filename.."Loginsvrd RankListsvrCMD.process invalid event:"..event)
		return nil
	end
	f(...)
end

function RankListsvrCMD.start(conf)
	msghelper:set_conf(conf)
	
	--开启定时器
	ranklistredismng.init()
		
	msgproxy.init(skynet.getenv("svr_id"))

	base.skynet_retpack(true)

end

function RankListsvrCMD.close(...)
	local server = msghelper:get_server()
	server:exit_service()	
end

function RankListsvrCMD.reload(...)
	base.skynet_retpack(1)
	filelog.sys_error("RankListsvrCMD.reload start")

	configdao.reload()

	skynet.sleep(200)

	msgproxy.reload()

	filelog.sys_error("RankListsvrCMD.reload end")
end

return RankListsvrCMD